<?php

jimport('joomla.application.component.modelitem');

class CouponsModelCodes extends JModelItem
{    
    private $id = null;
        
    public function __construct()
    {
        parent::__construct();
        
        $id = JRequest::getInt('id');
        if(is_integer($id));
            $this->id=$id;
    }
    
    public function getCodes()
    {
        $data = $this->_getList( 'SELECT uniqueCode FROM #__coupons where id= '.mysql_real_escape_string($this->id) );
        
        if($data!=null)
            $result = explode(" ",$data[0]->uniqueCode);
        return $result;
    }
    
    public function getId()
    {
        return $this->id;
    }
}
?>
